<?php
	include_once("../model/Acesso.class.php");
	include_once("../model/Mensagem.class.php");
	include_once("../model/Entrada.class.php");
	$entrada = new Entrada();
	$acesso = new Acesso();
	$codigoPagina = "15";
	if ($acesso->verificaPermissaoUsuario($codigoPagina)){
		$banco = $acesso->getBanco();
		$dataini = $_GET["dataini"];
		$dataini = substr($dataini,6,4) . "-" . substr($dataini,3,2) . "-" . substr($dataini,0,2);
		$datafim = $_GET["datafim"];
		$datafim = substr($datafim,6,4) . "-" . substr($datafim,3,2) . "-" . substr($datafim,0,2);
		$nota = $_GET["nota"];
		$fornecedor = $_GET["fornecedor"];
		$entradas = $entrada->selecionarEntrada($banco,$dataini,$datafim,$nota,$fornecedor);
		$cont = 1;	
		echo("<table width=\"100%\" border=\"2\" cellpadding=\"0\" cellspacing=\"0\"> 
                    <tr>
                      <td width=\"3%\" align=\"center\" bgcolor=\"#CCCCCC\" class=\"letraCampo\">&nbsp;</td>
                      <td width=\"55%\" align=\"center\" bgcolor=\"#CCCCCC\" class=\"letraCampo\">Fornecedor</td>
                      <td width=\"12%\" align=\"center\" bgcolor=\"#CCCCCC\" class=\"letraCampo\">Data Entrada</td>
                      <td width=\"17%\" align=\"center\" bgcolor=\"#CCCCCC\" class=\"letraCampo\">Numero NF</td>
                      <td width=\"13%\" align=\"center\" bgcolor=\"#CCCCCC\" class=\"letraCampo\">Valor Nota</td>
                    </tr>
		");
		$sel = "checked";
		while($ch = mysql_fetch_row($entradas)){
					$dt = $ch[2];
					$dt = substr($dt,8,2) . "/" . substr($dt,5,2) . "/" . substr($dt,0,4);
					echo("<tr>
                      <td align=\"center\" class=\"letraCampo\"><input name=\"id_chamado\" type=\"radio\" value=\"$ch[0]\" $sel></td>
                      <td class=\"letraCampo\">$ch[1]</td>
                      <td class=\"letraCampo\" align=\"center\" >$dt</td>
                      <td class=\"letraCampo\" align=\"center\" >$ch[3]</td>
                      <td class=\"letraCampo\" align=\"center\" >$ch[4]</td>
                    </tr>");
					$sel = "";
		}
		echo("</table>");			
		}
?>